<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>日期时间戳的使用</title>
</head>
<body>
    <script>
        const date = new Date();
        console.log(date);
        console.log(typeof date);//object
        console.log(date * 1);//时间戳


        const dt = Date();
        console.log(dt);
        console.log(typeof dt);//string
        console.log(dt * 1);//NaN


        // for循环运行的时间
        // let start = Date.now();
        // for(let i = 0; i < 2000000000; i++){}
        // let end = Date.now();
        // console.log((end - start) / 1000 + '秒');

        console.time("for");
        for(let i = 0; i < 2000000000; i++){}
        console.timeEnd("for");



        const riqi = new Date('1990-2-4 16:45:34');
        console.log(riqi);
        console.log(riqi.getMonth());

        const rq = new Date(1990,4,4,20,2,3);
        console.log(rq);

        const dd = [1990,3,4,6,4,6];
        const dd1 = new Date(...dd);
        console.log(dd1);

    </script>
</body>
</html>